package com.github.dreamyoung.mprelation.demo.controller;

import com.github.dreamyoung.mprelation.AutoMapper;
import com.github.dreamyoung.mprelation.demo.entity.Grade;
import com.github.dreamyoung.mprelation.demo.entity.Student;
import com.github.dreamyoung.mprelation.demo.service.StudentService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lxl
 * @date 2022/4/10
 */
@RestController
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private StudentService studentService;
    @Autowired
    private AutoMapper autoMapper;
    @RequestMapping("/oneToone")
    public Object  oneToone(){
        return studentService.list();
    }

    @RequestMapping("/manyTomany")
    public Object manyTomany(){
        List<Student> studentList=studentService.list();
        autoMapper.mapperEntityList(studentList,"subjectList");

        return studentList;
    }
}
